﻿@model RTracker.Areas.Recruitment.Models.Vacancy.GVacancy

@{
    ViewBag.ValidatorCls = "validTxtCls";
    var IsDisabled = "";
    var DefaultClass = "gd-disabled-cls";
    if (ViewBag.IsDisabled == true && Model.Vacancy.VacancyId != 0)
    {
        IsDisabled = "disabled";
    }

    List<RTracker.Models.User.CUser> lstUserDetails = (List<RTracker.Models.User.CUser>)HttpContext.Current.Application["UsersList"];

}


<form id="frm" class="form-horizontal mnt_form">
    <div class="form-body">
        @Html.HiddenFor(model => model.Vacancy.VacancyId)
        @Html.HiddenFor(model => model.Vacancy.CreatedBy)
        @Html.HiddenFor(model => model.Vacancy.VacancyId)
        @Html.HiddenFor(model => model.Vacancy.ClientId)

        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.VacancyName)</label>
                    <div class="col-md-9">
                        <input type="text" @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                               name="@Html.NameFor(model => model.Vacancy.VacancyName)"
                               placeholder="Enter @Html.DisplayNameFor(model => model.Vacancy.VacancyName)"
                               value="@(!Model.Vacancy.VacancyName.Trim().Equals(string.Empty) ? Model.Vacancy.VacancyName : "")">
                    </div>
                </div>
            </div>
            <!--/span-->
            <div class="col-md-6">
                <div class="form-group">
                    <label class="col-md-3 control-label">@Html.DisplayNameFor(model => model.Vacancy.OpeningDate)</label>
                    <div class="col-md-9">
                        <input type="text" @IsDisabled placeholder="dd-mm-yyyy" class="@ViewBag.ValidatorCls form-control datepicker-cls @IsDisabled"
                               name="@Html.NameFor(model => model.Vacancy.OpeningDate)" value="@(!Model.Vacancy.OpeningDate.ToString().Trim().Equals(string.Empty) ? Model.Vacancy.OpeningDate.Value.ToShortDateString() : "")">
                    </div>
                </div>
            </div>
            <!--/span-->
        </div>

        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.VacancyDesc)</label>
                    <div class="col-md-9">
                        <input type="text" @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                               name="@Html.NameFor(model => model.Vacancy.VacancyDesc)"
                               placeholder="Enter @Html.DisplayNameFor(model => model.Vacancy.VacancyDesc)"
                               value="@(!Model.Vacancy.VacancyDesc.Trim().Equals(string.Empty) ? Model.Vacancy.VacancyDesc : "")">
                    </div>
                </div>
            </div>
            <!--/span-->
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.RolesResponsibilities)</label>
                    <div class="col-md-9">
                        <input type="text" @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                               name="@Html.NameFor(model => model.Vacancy.RolesResponsibilities)"
                               placeholder="Enter @Html.DisplayNameFor(model => model.Vacancy.RolesResponsibilities)"
                               value="@(!Model.Vacancy.RolesResponsibilities.Trim().Equals(string.Empty) ? Model.Vacancy.RolesResponsibilities : "")">
                    </div>
                </div>
            </div>
            <!--/span-->
        </div>
        <!--/row-->
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.ClientId)</label>
                    <div class="col-md-9">
                        <select @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                                name="@Html.NameFor(model => model.Vacancy.ClientId)">
                            @if(ViewBag.IsNew == true) { <option value=''>Select</option> }
                            @if (Model.LstClient != null)
                            {
                                foreach (var item in Model.LstClient)
                                {
                                    <option value="@item.ClientId" @(Model.Vacancy.ClientId == item.ClientId ? "selected" : "")>@item.ClientName</option>
                                }
                            }
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.Department)</label>
                    <div class="col-md-9">
                        <select @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                                name="@Html.NameFor(model => model.Vacancy.Department)">
                            @if(ViewBag.IsNew == true) { <option value=''>Select</option> }
                            @if (Model.LstDepartment != null)
                            {
                                foreach (var item in Model.LstDepartment)
                                {
                                    <option value="@item.DepartmentId" @(Model.Vacancy.Department == item.DepartmentId ? "selected" : "")>@item.DepartmentName</option>
                                }
                            }
                        </select>
                    </div>
                </div>
            </div>
            <!--/span-->
        </div>
        <!--/span-->
    </div>
    <!--/row-->
    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.TechnicalSkills)</label>
                <div class="col-md-9">
                    <input type="text" @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                           name="@Html.NameFor(model => model.Vacancy.TechnicalSkills)"
                           placeholder="Enter @Html.DisplayNameFor(model => model.Vacancy.TechnicalSkills)"
                           value="@(!Model.Vacancy.TechnicalSkills.Trim().Equals(string.Empty) ? Model.Vacancy.TechnicalSkills : "")">
                </div>
            </div>
        </div>
        <!--/span-->
        <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.Keywords)</label>
                <div class="col-md-9">
                    <input type="text" @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                           name="@Html.NameFor(model => model.Vacancy.Keywords)"
                           placeholder="Enter @Html.DisplayNameFor(model => model.Vacancy.Keywords)"
                           value="@(!Model.Vacancy.Keywords.Trim().Equals(string.Empty) ? Model.Vacancy.Keywords : "")">
                </div>
            </div>
        </div>
        <!--/span-->
    </div>

    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.ExpirenceRange)</label>
                <div class="col-md-9">
                    <select @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                            name="@Html.NameFor(model => model.Vacancy.ExpirenceRange)">
                            @if(ViewBag.IsNew == true) { <option value=''>Select</option> }
                        @if (Model.LstVacancyExpirence != null)
                        {
                            foreach (var item in Model.LstVacancyExpirence)
                            {
                                <option value="@item.VacancyExpirenceId" @(Model.Vacancy.ExpirenceRange == item.VacancyExpirenceId ? "selected" : "")>@item.VacancyExpirenceName</option>
                            }

                        }
                    </select>
                </div>
            </div>
        </div>
        <!--/span-->
        <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.SalaryRange)</label>
                <div class="col-md-9">
                    <select @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                            name="@Html.NameFor(model => model.Vacancy.SalaryRange)">
                            @if(ViewBag.IsNew == true) { <option value=''>Select</option> }
                        @if (Model.LstVacancySalary != null)
                        {
                            foreach (var item in Model.LstVacancySalary)
                            {
                                <option value="@item.VacancySalaryId" @(Model.Vacancy.SalaryRange == item.VacancySalaryId ? "selected" : "")>@item.VacancySalaryName</option>
                            }

                        }
                    </select>
                </div>
            </div>
        </div>
        <!--/span-->
    </div>
    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.Shift)</label>
                <div class="col-md-9">
                    <select @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                            name="@Html.NameFor(model => model.Vacancy.Shift)">
                            @if(ViewBag.IsNew == true) { <option value=''>Select</option> }
                        @if (Model.LstShift != null)
                        {
                            foreach (var item in Model.LstShift)
                            {
                                <option value="@item.ShiftId" @(Model.Vacancy.Shift == item.ShiftId ? "selected" : "")>@item.ShiftName</option>
                            }

                        }
                    </select>
                </div>
            </div>
        </div>
        <!--/span-->
        <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.AllocatedTo)</label>
                <div class="col-md-9">
                    <select @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                            name="@Html.NameFor(model => model.Vacancy.AllocatedTo)">
                            @if(ViewBag.IsNew == true) { <option value=''>Select</option> }
                        @if (lstUserDetails != null)
                        {
                            foreach (var item in lstUserDetails)
                            {
                                <option value="@item.UserId" @(Model.Vacancy.AllocatedTo == item.UserId ? "selected" : "")>@(item.FirstName + " " + item.LastName)</option>
                            }
                        }
                    </select>
                </div>
            </div>
        </div>
        <!--/span-->
    </div>
    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.Status)</label>
                <div class="col-md-9">
                    <select @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                            name="@Html.NameFor(model => model.Vacancy.Status)">
                            @if(ViewBag.IsNew == true) { <option value=''>Select</option> }
                        @if (Model.LstVacancyStatus != null)
                        {
                            foreach (var item in Model.LstVacancyStatus)
                            {
                                <option value="@item.VacancyStatusId" @(Model.Vacancy.Status == item.VacancyStatusId ? "selected" : "")>@item.VacancyStatusName</option>
                            }
                        }
                    </select>
                </div>
            </div>
        </div>
        <!--/span-->
        <div class="col-md-6">
            <div class="form-group">
                <label class="control-label col-md-3">@Html.DisplayNameFor(model => model.Vacancy.NoticePeriodDays)</label>
                <div class="col-md-9">
                    <input type="text" @IsDisabled class="@ViewBag.ValidatorCls form-control @IsDisabled"
                           name="@Html.NameFor(model => model.Vacancy.NoticePeriodDays)"
                           placeholder="Enter @Html.DisplayNameFor(model => model.Vacancy.NoticePeriodDays)"
                           value="@(!Model.Vacancy.NoticePeriodDays.ToString().Trim().Equals(string.Empty) ? Model.Vacancy.NoticePeriodDays.ToString().Trim() : "")">
                </div>
            </div>
        </div>
        <!--/span-->
    </div>
    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-md-3 control-label">@Html.DisplayNameFor(model => model.Vacancy.CreatedByName)</label>
                <div class="col-md-9">
                    <input type="text" @IsDisabled placeholder="Enter Text" class="form-control @DefaultClass"
                           name="@Html.NameFor(model => model.Vacancy.CreatedByName)"
                           value="@(!Model.Vacancy.CreatedByName.Trim().Equals(string.Empty) ? Model.Vacancy.CreatedByName : "")" disabled>
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                <label class="col-md-3 control-label">@Html.DisplayNameFor(model => model.Vacancy.CreateTimestamp)</label>
                <div class="col-md-9">
                    <input type="text" @IsDisabled placeholder="dd-mm-yyyy" class="form-control @DefaultClass"
                           value="@(!Model.Vacancy.CreateTimestamp.ToString().Trim().Equals(string.Empty) ? Model.Vacancy.CreateTimestamp.ToString() : "")" disabled>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label class="col-md-3 control-label">@Html.DisplayNameFor(model => model.Vacancy.ModifiedByName)</label>
                <div class="col-md-9">
                    <input type="text" @IsDisabled placeholder="Enter Text" class="form-control @DefaultClass"
                           name="@Html.NameFor(model => model.Vacancy.ModifiedByName)"
                           value="@(!Model.Vacancy.ModifiedByName.Trim().Equals(string.Empty) ? Model.Vacancy.ModifiedByName : "")" disabled>
                </div>
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                <label class="col-md-3 control-label">@Html.DisplayNameFor(model => model.Vacancy.ModifiedTimestamp)</label>
                <div class="col-md-9">
                    <input type="text" @IsDisabled placeholder="dd-mm-yyyy" class="form-control @DefaultClass"
                           value="@(!Model.Vacancy.ModifiedTimestamp.ToString().Trim().Equals(string.Empty) ? Model.Vacancy.ModifiedTimestamp.ToString() : "")" disabled>
                </div>
            </div>
        </div>
    </div>
    </div>
    <div class="clearfix"></div>
    <div class="form-actions fluid right">
        <div class="col-md-12">
            @if (ViewBag.IsNew == false)
            {
                <img style="float:left" src="~/Content/Images/hardLock_closedx50.png" title="Set Lock" alt="" id="btn-setHardLock-id" value="@Model.Vacancy.VacancyId" class="cursor-pointer-cls @(Model.Vacancy.IsHardLocked ? "gd-disabled-cls" : "" ) " @ViewBag.StrDisabled />
                <img style="float:left" src="~/Content/Images/hardLock_openx50.png" title="Release Lock" alt="" id="btn-releaseHardLock-id" value="@Model.Vacancy.VacancyId" class="cursor-pointer-cls @(!Model.Vacancy.IsHardLocked ? "gd-disabled-cls" : "") " @ViewBag.StrDisabled />
            }
            <img src="~/Content/Images/cancel.png" @ViewBag.StrDisabled id="btn-cancel-id" class="cursor-pointer-cls" />
            <img src="~/Content/Images/save.png" @ViewBag.StrDisabled id="btn-Save-id" class="cursor-pointer-cls" />
        </div>
    </div>
</form>
<script type="text/javascript">
    $(".datepicker-cls").each(function () {
        $(this).datepicker({ dateFormat: "dd-mm-yy" });
        //alert($(this).val().replace("-", "/").replace("-", "/").replace("-", "/"));
        $(this).datepicker("setDate", $(this).val());
    })



</script>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

